#ifndef _CONNECTIONLISTENER_H_
#define _CONNECTIONLISTENER_H_

/**
 * Interface that allows for implementing classes to listen for connection closing
 * and reconnection events. Listeners are registered with XMPPConnection objects.
 *
 * @see XMPPConnection#addConnectionListener
 * @see XMPPConnection#removeConnectionListener
 * 
 * @author 
 */

class ConnectionListener {

public:
	virtual ~ConnectionListener(){}
    /**
     * Notification that the connection was closed normally or that the reconnection
     * process has been aborted.
     */
    virtual void connectionClosed() = 0;

    /**
     * Notification that the connection was closed due to an exception. When
     * abruptly disconnected it is possible for the connection to try reconnecting
     * to the server.
     *
     * @param e the exception.
     */
    virtual void connectionClosedOnError(std::string & err/*Exception e*/) = 0;
    
    /**
     * The connection will retry to reconnect in the specified number of seconds.
     * 
     * @param seconds remaining seconds before attempting a reconnection.
     */
    virtual void reconnectingIn(int seconds) = 0;
    
    /**
     * The connection has reconnected successfully to the server. Connections will
     * reconnect to the server when the previous socket connection was abruptly closed.
     */
    virtual void reconnectionSuccessful() = 0;
    
    /**
     * An attempt to connect to the server has failed. The connection will keep trying
     * reconnecting to the server in a moment.
     *
     * @param e the exception that caused the reconnection to fail.
     */
    virtual void reconnectionFailed(/*Exception e*/) = 0;
} ;

#endif // -- _CONNECTIONLISTENER_H_
